{extend name="common/main"}

{block name="css"}
<!-- 本页面需要额外添加的css请在此处添加 -->
<style>
    #cash_submit{
        color: white;
        background: red;
    }
    .tx_cash span {
        margin-top: 8px;

    }
</style>
{/block}
{block name="body"}
<body>      
<div id="tbh5v0">
<div class="user_com">

    <div class="com_top">
        <h2><a href="{:url('System/setting')}"></a></h2>
        <p class="tuij_cas">
            {$user['nickname']}
        </p>
        <dl>
            <dt>
                <img src="{if $user['head_pic'] }{$user['head_pic']}{else}/mobiled/images/user68.jpg{/if}"/>
            <dd>{$level_name.level_name}({$level_name.discount/100}折扣)</dd>
            </dt>
        </dl>
    </div>
    <div class="uer_topnav">
        <ul>

            <li style="width: 100%"><a href="{:url('Mobile/User/comment')}">我的佣金:￥{$commission}</a></li>
        </ul>
    </div>

<div class="endorse_hend">
	<p>提现信息</p>
</div>
    <div class="il_nav" id="J_il_nav">
        <a href="#Wallet" class="active" data-list="1">提现申请</a>
        <a href="#Funds"   data-list="2">佣金明细</a>
    </div>
    <!--提现申请-->
    <div id="Wallet" class="Wallet comm" >
	<div class="cash_num bb1">
        <form action="" method="post" enctype="multipart/form-data" name="distribut_form" id="distribut_form">
            <p class="tx_cash"><span>提现金额：</span><input type="text" id="money" name="money" placeholder="最少提现额度100" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"/></p>
            <p class="tx_cash"><span>银行名称：</span><input type="text" id="bank_name" name="bank_name" placeholder="如:支付宝,农业银行,工商银行等..."/></p>
            <p class="tx_cash"><span>收款账号：</span><input type="text" id="account_bank" name="account_bank" placeholder="如:支付宝账号,建设银行账号"/></p>
            <p class="tx_cash"><span>开户名：</span><input type="text" id="account_name" name="account_name" placeholder="开户人姓名"/></p>
            <!--<p class="tx_cash"><span>验证码：</span>-->
            <!--<input type="text" name="verify_code" id="verify_code" placeholder="请输入验证码" style="width:200px;" />-->
            <!--<img class="po-ab to0" id="verify_code_img" width="100" height="30" src="{:captcha_src('withdrawals')}"  onclick="this.src=this.src"  />-->
            <!--</p>-->
            <p><a id="cash_submit" href="javascript:void(0);" onClick="apply();">确定提交</a></p>
		</form>
	</div>
	<div class="cash_num">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="ajax_return">
			<tr>
				<th>编号</th>
				<th>申请日期</th>
				<th>金额</th>
				<th>状态</th>
			</tr>
           {foreach name="list" item="v" }
            <tr>
                <td>{$v['id']}</td>
                <td>{$v['create_time']}</td>
                <td>{$v['money']}</td>
                <td>
                    {if condition="$v['status'] eq 0"}申请中{/if}
                    {if condition="$v['status'] eq 1"}申请成功{/if}
                    {if condition="$v['status'] eq 2"}申请失败{/if}
                </td>
            </tr>
            {/foreach}
		</table>
	    {notempty name="list"}
	          <p style="text-align: center;" id="getmore"><a href="javascript:void(0)" onClick="ajax_sourch_submit()">点击加载更多</a></p>
        {/notempty}
	</div>
</div>
    <!--佣金明细-->
    <div id="Funds" class="Funds comm" style="display: none">
        <ul>
            {volist name='rebate_log' id='vo' key='k'}
            <li class="Funds_li" >
                <span class="icon"></span>



                <span>佣金金额:<em>{$vo.money}</em></span>
                <span>级别:<em>下{$vo.level}级</em></span>
                <span>用户名:<em>{$vo.nickname}</em></span>
                <span>时间:<em>{$vo.create_time}</em></span>


            </li>
            {/volist}
        </ul>
    </div>

</div>

</div>
{include file="common/bar"}
</body>
{/block}
{block name="js"}
<script src="/layer/layer.js"></script>
<script>

 $(function () {
     $('#J_il_nav a').click(function () {
         console.log($(this).attr('href'));
         $('#J_il_nav a').removeAttr('class');
         $(this).attr('class','active');
         $('.comm').css('display','none');
         $($(this).attr('href')).css('display','block');
     });
 });
//申请提交
function apply(){
    var param = new Object();
    $("input").each(function(k, v){
        v = $(v);
        param[v.attr("id")] = v.val();
    });
    if(param['money'] == '') {
        layer.msg('提现金额必填', {icon: 2});
        return false;
    }
    if(param['bank_name'] == '') {
        layer.msg('银行名称必填', {icon: 2});
        return false;
    }
    if(param['account_bank'] == '') {
        layer.msg('收款账号必填', {icon: 2});
        return false;
    }
    if(param['account_name'] == '') {
        layer.msg('开户名必填', {icon: 2});
        return false;
    }
    $.post("{:url('User/withdrawals')}",param, function(ret){
        if(ret.code != 200){
            layer.msg(ret.msg, {icon: 2});
            return false;
        }
        layer.msg(ret.msg, {icon: 1,time:2000},function(){
            location.href="{:url('User/withdrawals')}";
        });
    });
}

var  page = 1;
 /*** ajax 提交表单 查询订单列表结果*/  
 function ajax_sourch_submit()
 {	 	 	 
        page += 1;
		$.ajax({
			type : "GET",			
			url:"{:url('User/withdrawals')}",
			data :{
			    page:page,
            },
			success: function(data)
			{
				if($.trim(data) == '')
					$('#getmore').hide();
				else{
				    $("#ajax_return").append(data);
				}
			}
		}); 
 } 
 
</script>
{/block}